package com.pic.others.controller;


import com.pic.common.utils.R;
import com.pic.others.domain.dto.recyle.RecyleFormDTO;
import com.pic.others.domain.dto.recyle.RecyleManyDTO;
import com.pic.others.domain.po.Recyle;
import com.pic.others.service.IRecyleService;
import com.pic.others.service.impl.RecyleServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequiredArgsConstructor
@RequestMapping("/recyle")
@Api(tags = "关于回收操作")
@Slf4j
public class RecyleController {

    private final IRecyleService recyleService;

    @ApiOperation("得到回收图片")
    @GetMapping("/getRecylePicture")
    public R<List<RecyleFormDTO>> getRecylePicture(){
        return recyleService.getRecylePicture();
    }

    @ApiOperation("删除回收图片")
    @GetMapping("/deleteByRecyleId/{recyleId}")
    private R<String>deleteByRecyleId(@PathVariable("recyleId") Long recyleId){
        return recyleService.deleteByRecyleTime(recyleId);
    }

     @ApiOperation("批量输出回收图片")
     @PostMapping("/deleteByRectleByIds")
     private R<String>deleteByRecyleIds(@RequestBody List<Long>recyleIds){
        return recyleService.deleteByRecyleIds(recyleIds);
     }

     @ApiOperation("批量恢复回收图片")
     @PostMapping("/updatePictureRecyleStatus")
     private R<String>updatePictureRecyleStatusByIds(@RequestBody List<Long>recyleIds){
        log.info("进入批量恢复图片");
        return recyleService.updatePictureRecyleStatusByIds(recyleIds);
     }


    @ApiOperation("恢复回收站一张图片")
    @GetMapping("/updatePictureRecyleStatus/{recyleId}")
    private R<String>updatePictureRecyleStatus(Long recyleId){
        return recyleService.updatePictureRecyleStatus(recyleId);
    }

    @ApiOperation("删除所有回收站图片")
    @PostMapping("/deleteAllPictures")
    private R<String>deleteAllPictures(){
        return recyleService.deleteAllPictures();
    }

    @ApiOperation("点击图片,大概是阿灵说的把")
    @GetMapping("/{recyleId}")
    private R<RecyleManyDTO>getRecylesByRecyleId(@PathVariable("recyleId")Long recyleId){
        return recyleService.getRecylesByRecyleId(recyleId);

    }



}
